"use strict";
var countLines = function (text) {
    var count = 0;
    for (var _i = 0, _a = text || []; _i < _a.length; _i++) {
        var line = _a[_i];
        if (line.length !== 0) {
            count += 1;
        }
    }
    return count;
};
var runOneHelloWorld = function (lines) {
    console.log(countLines(lines));
};
var runHelloWorld = function () {
    runOneHelloWorld(['one', 'two', 'three', 'four']);
    runOneHelloWorld();
};
;
var sortByName = function (a) {
    a.sort(function (b, c) { return b.name === c.name ? 0 : (b.name < c.name ? -1 : 1); });
};
var getPersons = function (n, maxValue) {
    var result = [];
    for (var i = 0; i < n; i++) {
        result.push({
            name: 'id-' + Math.floor(Math.random() * maxValue),
        });
    }
    return result;
};
var runInterface = function () {
    var persons = getPersons(10, 100);
    sortByName(persons);
    persons.forEach(function (person) { return console.log(person.name); });
};
var runDemo = function (demo) {
    demo.runner();
};
var runConciseDemo = function (demo) {
    demo.runner();
};
// runDemo({ feature: 'hello-world', runner: runHelloWorld});
// runDemo({ feature: 'interface', runner: runInterface});
runConciseDemo({ feature: 'hello-world', runner: runHelloWorld });
var assertNever = function (obj) {
    throw new Error('unexpected object: ' + JSON.stringify(obj));
};
var handleDemos = function (demo) {
    switch (demo.feature) {
        case 'hello-world':
            console.log('the feature is hello world');
            return;
        case 'interface':
            console.log('the feature is interface');
            return;
    }
    assertNever(demo.feature);
};
